<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/website/common/base.jsp"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${webname }-会员中心</title>
<%@ include file="/website/common/common.jsp"%>
<link href="${webctx }/css/manage.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${webctx}/js/sms.js"></script>
</head>

<body>
<%@ include file="/website/common/top.jsp"%>
<%@ include file="/website/common/head.jsp"%>
<%@ include file="/website/common/menu.jsp"%>

<div class="warp-body">
	<div class="inner clearfix">
    	<div class="left-main">
        	<div class="left-inner">
            	<%@ include file="/website/user/left.jsp"%>
            </div>
        </div>
    	<div class="right-main">
        	<div class="right-inner">
            	<div class="right-title"><span></span>修改登录密码：</div>
                <div class="chpassw-inner" id="page1">
                    <ul class="items">
                        <li class="item">
                            <div class="item-title">初始密码：</div>
                            <div class="itemInp-ct">
                    			<div class="ipt norWidthIpt" ><input name="oldpwd" type="password" class="inp" placeholder="请原始旧密码"></div>
                    		</div>
                            <div class="itemTip"></div>
                        </li>
                        <li class="item">
                            <div class="item-title">新的密码：</div>
                            <div class="itemInp-ct">
                    			<div class="ipt norWidthIpt"><input name="newpwd" type="password" class="inp"  placeholder="请输入新密码"></div>
                    		</div>
                            <div class="itemTip"></div>
                        </li>
                        <li class="item">
                            <div class="item-title">重复密码：</div>
                            <div class="itemInp-ct">
                    			<div class="ipt norWidthIpt"><input name="pwd2" type="password" class="inp" placeholder="再一次输入新密码"></div>
                    		</div>
                            <div class="itemTip"></div>
                        </li>
                                       
                        <li class="item">
                            <div class="itemInp-ct pt-20"><a href="javascript:tonext();" class="reg-btn">下一步</a></div>
                        </li>
                    </ul>	
                </div>         	
                <div class="modif-inner hide" id="page2">
                	<div class="modif-txt">
                    	<div><span class="modif-icon"></span></div>
                    	<div>密码修改成功</div>
                    </div>
                </div> 
            </div>
        </div>
    </div>
</div>

<%@ include file="/website/common/foot.jsp"%>
</body>
</html>
<script>
$(function(){
	setLeftCur("zhugl");
	
})
function tonext(){
	var checked=true;
	$(".itemTip").text('');
	if($("[name='oldpwd']").val()==''){
		$("[name='oldpwd']").parent().parent().next().text("请输入旧密码");
		checked=false;
	}
	if($("[name='newpwd']").val().length<6){
		$("[name='newpwd']").parent().parent().next().text("至少六位数密码");
		checked=false;
	}
	if($("[name='pwd2']").val()!=$("[name='newpwd']").val()){
		$("[name='pwd2']").parent().parent().next().text("请再一次输入密码");
		checked=false;
	}
	if(checked){
		$w.httpRequest({
			url:apiroot+"/user/changepwd",
			data:{"oldpwd":$("[name='oldpwd']").val(),"newpwd":$("[name='newpwd']").val()},
			ok:function(ret){
				$("#page1").hide();
				$("#page2").show();
			},fail:function(ret){
				$("[name='oldpwd']").parent().parent().next().text(ret.MsgDesc);
				return false;
			}
		})
	}
}
</script>